package com.genius.smsdao.coursemanage.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.genius.smsbase.Domain.BaseEntity;

import javax.persistence.*;
import java.util.List;


/**
 * @Entity:CourseKind 课程种类实体类
 * 对应数据库表名：course_kind
 * @author：gpf
 */
@Entity
@Table(name = "course_kind")
public class CourseKind extends BaseEntity<Long> {

    @Column
    String name;

    //配置Course到CourseKind的多对一关系
    @JsonIgnoreProperties(value = "courseKind", allowSetters = true)
    @OneToMany(mappedBy = "courseKind",cascade = {CascadeType.REMOVE,CascadeType.REFRESH},fetch = FetchType.EAGER)
    private List<Course> courseList;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Course> getCourseList() {
        return courseList;
    }

    public void setCourseList(List<Course> courseList) {
        this.courseList = courseList;
    }

    @Override
    public String toString() {
        return "CourseKind{" +
                "name='" + name + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", id=" + id +
                '}';
    }
}
